Skip to content

fix(test): return KindConnection error on polling timeout - #585

Merged
yada merged 1 commit into
microcks:masterfrom
ish-g09:fix/test-polling-timeout-exit-code
Oct 27, 2026
Merged

yada merged 1 commit into
microcks:masterfrom
ish-g09:fix/test-polling-timeout-exit-code

Conversation

@ish-g09

@ish-g09 ish-g09 commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

Description

  • Hoisted inProgress variable out of the polling loop in cmd/testExecutor.go to track test state after the deadline expires.
  • Returned errors.Wrapf(errors.KindConnection, ...) if inProgress is still true after the loop so the CLI exits with code 11 instead of 1.
  • Skipped renderTestResult on timeouts so unfinished tests are not falsely reported as contract failures (FAILURE 0ms).
  • Added unit test in cmd/testExecutor_test.go asserting errors.KindConnection and exit code 11.

Related issue(s)

Fixes #573

AI Disclosure

The code changes and unit test were written and verified by me. I fully understand them. I used an AI assistant to discuss the error-handling architecture.

Testing

  • go build ./... : passes
  • go test ./... : all packages pass
  • go test -v -count=1 -run TestRunTestAndWait_TimeoutReturnsKindConnection ./cmd : passes (asserts exit code 11)
  • Manual CLI test against hanging mock server: verified timeout error on stderr and exit code 11
$ ./microcks test "MyAPI:1.0" "http://localhost:8080" HTTP --microcksURL=http://127.0.0.1:8888 --waitFor=100milli
MicrocksClient got status for test "test-hanging-1" - success: false, inProgress: true 
MicrocksTester waiting for 2 seconds before checking again or exiting.
...
test polling timed out after 10100ms waiting for result test-hanging-1
$ echo $?
11
Screenshot 2026-10-15 at 16 38 10

Copilot AI balanced review requested due to automatic review settings October 15, 2026 11:11

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@yada

yada commented Oct 27, 2026

Copy link
Copy Markdown
Member

Thanks @ish-g09! I verified this on the PR head against master (b1415aa) with a fake server whose test result stays inProgress: true, --waitFor 3sec:

No regression on the other paths (checked against master and the PR):

  • passing run: exit 0
  • failing run (success:false, inProgress:false): exit 1
  • a test that finishes after a few polls: exit 0

go vet and go test ./... pass on the head. This also covers the runtime check you asked about in #573.

Disclosure: this comment was drafted with AI assistance, and the results were run locally.

@yada yada left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified at runtime and with tests, see the comment above. Disclosure: review drafted with AI assistance.

@yada
yada merged commit df23431 into microcks:master Oct 27, 2026
7 checks passed
@ish-g09
ish-g09 deleted the fix/test-polling-timeout-exit-code branch October 27, 2026 13:35

This branch was successfully deployed

1 active deployment
Build — 628fc155 Deployed Oct 15, 2026 by ish-g09 via build-verify-package #802
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

microcks test exits with code 1 (contract failure) instead of code 11 (connection) when polling loop times out

3 participants